<template>
  <div class="discuss">
    <!-- 讨论 -->
    <header>
      <span>讨论</span>
    </header>
    <div
      class="question-answer-list one-px-border-bottom one-px-border-top"
      v-for="item in questions"
      :key="item.id"
    >
      <article class="question-answer">
        <div class="question">{{ item.question.content }}</div>
        <div class="answer-num">{{ item.question.answerCnt }}个讨论</div>
        <div class="answer">{{item.answer.content}}</div>
      </article>
       <!-- v-if="item.question && item.question.content" -->
        <!-- v-if="item.answer && item.answer.content" -->
    </div>
  </div>
</template>

<script>
export default {
  props: {
    questions: Array,
  },
};
</script>

<style lang="less" scoped>
.discuss {
  margin-top: 12px;
  background-color: #fff;
  header {
    font-size: 15px;
    color: #333;
    height: 45px;
    line-height: 45px;
    padding-left: 15px;
    span {
      font-size: 15px;
    }
  }
  .question-answer-list,
  .one-px-border-bottom,
  .one-px-border-top {
    position: relative;
    border-top: none;
    border-bottom: none;
    box-sizing: border-box;
    ::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      background: #e8e8e8;
      width: 100%;
      height: 1px;
      transform: scaleY(0.5);
      transform-origin: 0 0;
    }
    .question-answer {
      padding: 12px 15px;
      .question {
        font-size: 17px;
        color: #333;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        text-overflow: ellipsis;
        word-wrap: break-word;
        word-break: break-all;
        overflow: hidden;
        font-weight: 700;
      }
      .answer-num {
        margin-top: 2px;
        font-size: 12px;
        color: #666;
      }
      .answer {
        margin-top: 12px;
        font-size: 13px;
        color: #666;
        letter-spacing: 0;
        line-height: 19px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        text-overflow: ellipsis;
        word-wrap: break-word;
        word-break: break-all;
        overflow: hidden;
      }
    }
  }
}
</style>